home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-01 | 2.7 KB | 97 lines | [TEXT/MPS ] |
- ;=============================================================================
- ; UMacAppUtilities assembly language routines
- ;
- ; KNOWN LIMITATIONS
- ;
- ; Copyright © 1987-1990 Apple Computer, Inc. All rights reserved.
- ;
- ; when who what
- ; -------- ---- --------------------------------------------------------------
- ; 88.07.28 srf add header and includes for Macros
- ; ----------------------------------------------------------------------------
-
- Blanks On
- String AsIs
- Case On
-
- Print Off
- Include 'Macros.a'
-
- LOAD 'ProgStrucMacs.d'
- LOAD 'FlowCtlMacs.d'
- Print On
-
-
- ;---------------------------------------------------------------------------------------------------
- ; FUNCTION EqualBlocks(first, second: UNIV Ptr; theSize: INTEGER): BOOLEAN;
- ; Returns true if blocks pointed to by 'first' and 'second' are equal over
- ; 'theSize' number of bytes.
- ; Trashes: D0,D1,A0,A1
-
- Seg 'MAUtilitiesRes'
- EXPORT FUNCTION EQUALBLOCKS(first:L, second:L, theSize):B
- VAR addrStore:L
-
- BEGIN
-
- Move.B #1,EQUALBLOCKS(FP) ; Prime result to TRUE
-
- Move.L first(FP),A0 ; Point at data blocks
- Move.L second(FP),A1
- Move theSize(FP),D0 ; Fetch count
-
- * handle odd-addressing
- Tst D0 ; Anything to compare?
- Beq.S @4 ; Nope, we're done
- Move.L A0,addrStore(FP)
- Move.L addrStore(FP),D1 ; Work with address
- And #1,D1 ; Is it odd?
- Beq.S @0 ; If it ain't, go on to normal stuff
- CmpM.B (A0)+,(A1)+ ; Check the odd address
- Bne.S @3 ; Not equal, so punt
- SubQ #1,D0 ; One less value to check
-
- * even-addressing
- @0: Move D0,D1 ; Sub-long count
- And #3,D1
- LsR #2,D0 ; Long count
- Beq.S @1 ; No longs, so try sub-longs
- SubQ #1,D0 ; Back off one for DBeq
-
- @2: CmpM.L (A0)+,(A1)+ ; Compare values
- DBne D0,@2
- Bne.S @3 ; Not equal, so punt
-
- @1: Tst D1 ; Any sub-longs?
- Beq.S @4 ; Nope, we're done
- SubQ #1,D1 ; Back off one for DBeq
-
- @5: CmpM.B (A0)+,(A1)+ ; Compare values
- DBne D1,@5
-
- Beq.S @4 ; Equal, so we're done
-
- @3: Clr.B EQUALBLOCKS(FP) ; Signal false
-
- @4: Return
- ENDF
-
- ;---------------------------------------------------------------------------------------------------
- ; FUNCTION StripLong(address: UNIV Ptr): LONGINT;
- ; Masks address with a pre-stripped address to avoid icky StripAddress glue !
- ; Can't use "C" attribute for function since Think™ Pascal can't take the heat (TP 3.0)
- ; Trashes: D0
-
- Seg 'MAUtilitiesRes'
- EXPORT FUNCTION STRIPLONG(address:L):L
-
- BEGIN
- IMPORT gStrippedAddress:Data
- MOVE.L gStrippedAddress(A5),D0
- AND.L address(FP),D0
- MOVE.L D0, STRIPLONG(FP)
- Return
- ENDP
-
- END
-